// pages/applyPage/applyPage.js
// @ts-ignore
// @ts-ignore
const app=getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    range:"",
    village:"",
    nickname:"",
    name:""
    ,phone:""
    ,detairange:""
    ,mark:""
    ,indexrange: null,
    indexvillage: null,
    arrayrange: ['美国', '中国', '巴西', '日本'],
    arrayvillage: ['美国', '中国', '巴西', '日本'],
    userInfo:""
  },
  methods:{

  },
  onLoad(): void | Promise<void> {
    this.setData({
      userInfo:app.globalData.userInfo
    })
  },
  

  bindPickerChange: function (e:any) {
    let _that:any=this
    this.setData({
      [`index${e.target.id}`]: e.detail.value,
      [e.target.id]:_that.data[`array${e.target.id}`][e.detail.value]
    });
  },

  inputbtn:function (){
    let {range,village,nickname,name,phone,mark,detairange}=this.data
    let data={
      range, village, nickname, name,phone,detairange,mark}
    wx.showModal({
      title: '提示',
      content:  JSON.stringify(data),
      success (res) {
        if (res.confirm) {
          console.log('用户点击confirm')
        } else if (res.cancel) {
          console.log('用户点击取消')
        }
      }
    })


  },
  bindInput:function (e:any){
    this.setData({
      [e.target.id]:e.detail.value
    });
  },
  
  backPrePage:function (){
    wx.navigateBack({
      delta: 1
    })
  }
  
})